package com.sekla.comfunc;

public class TestYield {
    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
            int cnt = 0;
            for (;;){
                System.out.println("-1" + cnt++);
            }
        });
        Thread t2 = new Thread(() -> {
            int cnt = 0;
            for (;;) {
                Thread.yield();
                System.out.println(" --->> 2" + cnt ++);
            }
        });

        t1.start();
        t2.start();

//        t1.setPriority(Thread.MIN_PRIORITY);
//        t2.setPriority(Thread.MAX_PRIORITY);
    }
}
